# -*- coding: utf-8 -*- #
"""
项目配置文件
APPLICATION_SETTINGS为应用配置参数
"""

import os
import sys
from tornado_jinja2 import Jinja2Loader
from tornado.options import options
abspath = os.path.dirname(__file__)
sys.path.append(abspath)
os.chdir(abspath)
print 'options.env:{env},options.port:{port}'.format(env=options.env, port=options.port)
env = options.env

MYSQL_HOST = '139.199.26.174'
MYSQL_MANAGE_USERNAME = 'ymanage'
MYSQL_MANAGE_PASSWORD = 'ymanage1989'
MYSQL_MANAGE_DBNAME = 'ymanage'

MYSQL_WECHAT_USERNAME = 'wechat'
MYSQL_WECHAT_PASSWORD = 'wechat!@#$1989'
MYSQL_WECHAT_DBNAME = 'wechat'

MYSQL_DB_PORT = 3306

IS_CHECK_SIGN = False  # checksign方法中是否验证签名


#
mysql_ymanage_dict = dict(
    host=MYSQL_HOST, port=MYSQL_DB_PORT,
    user=MYSQL_MANAGE_USERNAME,
    pwd=MYSQL_MANAGE_PASSWORD,
    db=MYSQL_MANAGE_DBNAME, charset='utf8',
    max_idle_connections=10,
    max_open_connections=100,
    max_recycle_sec=3
)


mysql_wechat_dict = dict(
    host=MYSQL_HOST, port=MYSQL_DB_PORT,
    user=MYSQL_WECHAT_USERNAME,
    pwd=MYSQL_WECHAT_PASSWORD,
    db=MYSQL_WECHAT_DBNAME, charset='utf8',
    max_idle_connections=10,
    max_open_connections=100,
    max_recycle_sec=3
)

APPLICATION_SETTINGS = dict(
    debug=True,
    cookie_secret='random key',
    login_url='/login',
    template_loader=Jinja2Loader('./templates/'),
    static_path=os.path.join(os.path.dirname(__file__), 'static')
)
